package com.we.wfc.sender.bo;

import com.we.wfc.common.utils.ConverterUtil;
import lombok.Getter;

import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;

/**
 * @Description: 邮件业务对象
 * @Author:Liangzy(Feeling)
 * @Date:Create in 2019/11/7 2:03 下午
 */
@Getter
public class EmailBo implements Serializable {

    /**
     * 序列化ID
     */
    private static final long serialVersionUID = -7335755766873269410L;

    /**
     * 发送的邮箱账号
     */
    private String account;

    /**
     * 发送的内容
     */
    private String sendMsg;

    /**
     * 过期时间(秒)若为负数则不会过期
     */
    private Date exprire;

    public void setAccount(String account) {
        this.account = account;
    }

    public void setSendMsg(String sendMsg) {
        this.sendMsg = sendMsg;
    }

    public void setExprire(int expireSecond) {
        if (expireSecond >= 0) {
            this.exprire = ConverterUtil.addDate(new Date(), Calendar.SECOND, expireSecond);
        }
    }
}
